<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自动化构建与部署指南 | DevOps实践</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .code-block {
            background: #f8f8f8;
            border-radius: 8px;
            padding: 1.5rem;
            position: relative;
            overflow: hidden;
            border-left: 4px solid #4F46E5;
        }
        .code-block:hover .copy-btn {
            opacity: 1;
        }
        .copy-btn {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            background: rgba(255,255,255,0.8);
            border: none;
            border-radius: 4px;
            padding: 0.25rem 0.5rem;
            font-size: 0.8rem;
            opacity: 0;
            transition: opacity 0.3s ease;
            cursor: pointer;
        }
        .copy-btn:hover {
            background: white;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
        }
        .card-hover {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }
        .highlight-box {
            border-left: 4px solid #4F46E5;
            padding: 1rem 1.5rem;
            background: rgba(79, 70, 229, 0.05);
            border-radius: 0 8px 8px 0;
        }
        .animate-fade-in {
            animation: fadeIn 0.5s ease-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 md:px-12 max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0 animate-fade-in">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 leading-tight">自动化构建与部署</h1>
                    <p class="text-xl mb-8 opacity-90">DevOps实践的关键环节</p>
                    <p class="text-lg mb-8 opacity-90">探索如何通过自动化CI/CD流水线提升开发效率、减少错误并加速交付周期</p>
                    <div class="flex space-x-4">
                        <a href="#why-automate" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition duration-300">
                            <i class="fas fa-question-circle mr-2"></i>为什么需要自动化
                        </a>
                        <a href="#maven-gradle" class="bg-indigo-700 text-white px-6 py-3 rounded-lg font-medium hover:bg-indigo-800 transition duration-300">
                            <i class="fas fa-cogs mr-2"></i>构建工具指南
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center animate-fade-in">
                    <div class="relative w-full max-w-md">
                        <div class="absolute inset-0 bg-indigo-500 rounded-xl opacity-20 transform rotate-6"></div>
                        <div class="relative bg-white rounded-xl shadow-2xl p-6 text-gray-800">
                            <div class="flex items-center mb-4">
                                <div class="h-3 w-3 rounded-full bg-red-500 mr-2"></div>
                                <div class="h-3 w-3 rounded-full bg-yellow-500 mr-2"></div>
                                <div class="h-3 w-3 rounded-full bg-green-500"></div>
                                <div class="ml-4 text-sm font-medium">Jenkinsfile</div>
                            </div>
                            <div class="code-block bg-gray-100 rounded-md p-4 font-mono text-sm">
                                <span class="text-purple-600">pipeline</span> {<br>
                                &nbsp;&nbsp;<span class="text-blue-600">agent</span> any<br><br>
                                &nbsp;&nbsp;<span class="text-blue-600">stages</span> {<br>
                                &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-green-600">stage</span>(<span class="text-yellow-600">'Build'</span>) {<br>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-600">steps</span> {<br>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sh <span class="text-yellow-600">'mvn clean package'</span><br>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                                &nbsp;&nbsp;&nbsp;&nbsp;}<br>
                                &nbsp;&nbsp;}<br>
                                }
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 md:px-12 py-16 max-w-6xl">
        <!-- Benefits Section -->
        <section id="why-automate" class="mb-20">
            <div class="flex items-center mb-10">
                <div class="h-1 bg-indigo-500 w-16 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">为什么要实现自动化构建与部署？</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="text-indigo-500 mb-4">
                        <i class="fas fa-hand-paper text-4xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">传统方式的痛点</h3>
                    <ul class="space-y-3 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-exclamation-circle text-red-400 mt-1 mr-2"></i>
                            <span>手动执行多个步骤（打包、上传、启动）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-clock text-yellow-500 mt-1 mr-2"></i>
                            <span>操作繁琐且耗时</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-bug text-purple-500 mt-1 mr-2"></i>
                            <span>容易引入人为错误</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-desktop text-blue-500 mt-1 mr-2"></i>
                            <span>环境不一致导致"在我本地可以运行"问题</span>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="text-green-500 mb-4">
                        <i class="fas fa-robot text-4xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">自动化带来的优势</h3>
                    <ul class="space-y-3 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span><strong>减少人为错误：</strong>消除重复性手工操作导致的失误</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-bolt text-yellow-500 mt-1 mr-2"></i>
                            <span><strong>提高交付效率：</strong>代码提交后自动构建、测试、部署</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-cubes text-indigo-500 mt-1 mr-2"></i>
                            <span><strong>统一构建环境：</strong>所有开发人员使用相同的构建工具</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-history text-blue-500 mt-1 mr-2"></i>
                            <span><strong>快速回滚：</strong>新版本有问题可快速回退到稳定版本</span>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="highlight-box mb-8">
                <div class="flex items-start">
                    <div class="text-indigo-500 text-2xl mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h3 class="font-semibold text-lg mb-2">关键洞察</h3>
                        <p class="text-gray-700">自动化构建与部署不仅仅是技术实现，更是一种开发理念的转变，它要求团队从手动操作转向标准化、可重复的流程，从而实现更高效、更可靠的软件交付。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Build Tools Section -->
        <section id="maven-gradle" class="mb-20">
            <div class="flex items-center mb-10">
                <div class="h-1 bg-indigo-500 w-16 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">自动化构建：使用 Maven/Gradle</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <div class="bg-white p-6 rounded-xl shadow-md mb-8 card-hover">
                        <div class="flex items-center mb-4">
                            <img src="https://maven.apache.org/images/maven-logo-black-on-white.png" alt="Maven" class="h-10 mr-3">
                            <h3 class="text-xl font-semibold">Maven 构建工具</h3>
                        </div>
                        <p class="text-gray-600 mb-4">Maven 是 Java 生态中最常用的构建工具，它可以管理依赖、编译代码、运行测试、打包 JAR/WAR 以及执行部署。</p>
                        
                        <h4 class="font-medium text-gray-800 mb-2">Maven 构建 Java 项目主要步骤：</h4>
                        <ol class="list-decimal pl-5 space-y-2 text-gray-600">
                            <li>定义 POM 文件 (<code>pom.xml</code>)</li>
                            <li>执行 Maven 命令</li>
                        </ol>
                    </div>

                    <div class="code-block relative">
                        <button class="copy-btn" onclick="copyCode(this)"><i class="fas fa-copy mr-1"></i>复制</button>
                        <pre><code class="language-xml">&lt;project&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.ts&lt;/groupId&gt;
    &lt;artifactId&gt;my-app&lt;/artifactId&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
            &lt;version&gt;2.7.2&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                &lt;version&gt;3.8.1&lt;/version&gt;
                &lt;configuration&gt;
                    &lt;source&gt;11&lt;/source&gt;
                    &lt;target&gt;11&lt;/target&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
&lt;/project&gt;</code></pre>
                    </div>
                </div>

                <div>
                    <div class="bg-white p-6 rounded-xl shadow-md mb-8 card-hover">
                        <div class="flex items-center mb-4">
                            <img src="https://gradle.org/images/gradle-knowledge-graph-logo.png?20170228" alt="Gradle" class="h-10 mr-3">
                            <h3 class="text-xl font-semibold">Gradle 构建工具</h3>
                        </div>
                        <p class="text-gray-600 mb-4">Gradle 相比 Maven 更灵活，可用于更复杂的项目。它使用 Groovy 或 Kotlin DSL 作为构建脚本，支持增量构建。</p>
                        
                        <h4 class="font-medium text-gray-800 mb-2">Gradle 构建命令：</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-600">
                            <li><code>gradle build</code>：执行构建</li>
                            <li><code>gradle test</code>：运行测试</li>
                            <li><code>gradle bootRun</code>：运行 Spring Boot 项目</li>
                        </ul>
                    </div>

                    <div class="code-block relative">
                        <button class="copy-btn" onclick="copyCode(this)"><i class="fas fa-copy mr-1"></i>复制</button>
                        <pre><code class="language-groovy">plugins {
    id 'java'
    id 'application'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'junit:junit:4.13'
}

tasks.named('test') {
    useJUnitPlatform()
}

application {
    mainClass = 'com.ts.App'
}</code></pre>
                    </div>
                </div>
            </div>

            <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                <h3 class="text-xl font-semibold mb-4 text-center">Maven 与 Gradle 比较</h3>
                <div class="overflow-x-auto">
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">特性</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Maven</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Gradle</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">配置语言</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">XML</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">Groovy/Kotlin DSL</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">构建性能</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">较慢</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">快（支持增量构建）</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">灵活性</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">较低</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">高</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">社区生态</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">成熟</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">快速增长</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </section>

        <!-- Deployment Tools Section -->
        <section id="deployment" class="mb-20">
            <div class="flex items-center mb-10">
                <div class="h-1 bg-indigo-500 w-16 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">自动化部署工具</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <img src="https://www.jenkins.io/images/logos/jenkins/jenkins.png" alt="Jenkins" class="h-10 mr-3">
                            <h3 class="text-xl font-semibold">Jenkins</h3>
                        </div>
                        <p class="text-gray-600 mb-4">Jenkins 是目前最流行的自动化 CI/CD 工具，能够自动拉取代码、构建项目、运行测试，并将应用程序部署到服务器。</p>
                        
                        <h4 class="font-medium text-gray-800 mb-2">Jenkins 部署步骤：</h4>
                        <ol class="list-decimal pl-5 space-y-2 text-gray-600">
                            <li>安装 Jenkins 并添加必要插件</li>
                            <li>配置 Git 和 Maven</li>
                            <li>设置 SSH 访问服务器</li>
                            <li>编写 Jenkinsfile 定义流水线</li>
                        </ol>
                    </div>
                    <div class="bg-gray-50 p-6">
                        <div class="code-block relative">
                            <button class="copy-btn" onclick="copyCode(this)"><i class="fas fa-copy mr-1"></i>复制</button>
                            <pre><code class="language-groovy">pipeline {
    agent any

    stages {
        stage('Clone Repository') {
            steps {
                git branch: 'main', url: 'https://github.com/your-repo.git'
            }
        }

        stage('Build') {
            steps {
                sh 'mvn clean package'
            }
        }

        stage('Unit Test') {
            steps {
                sh 'mvn test'
            }
        }

        stage('Deploy to Server') {
            steps {
                sshagent(['deploy-server']) {
                    sh 'scp target/my-app.jar user@server:/home/user/app.jar'
                    sh 'ssh user@server "nohup java -jar /home/user/app.jar &"'
                }
            }
        }
    }
}</code></pre>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png" alt="GitHub Actions" class="h-8 mr-3">
                            <h3 class="text-xl font-semibold">GitHub Actions</h3>
                        </div>
                        <p class="text-gray-600 mb-4">GitHub Actions 是 GitHub 内置的 CI/CD 工具，无需额外的服务器。它可以响应代码推送等事件，自动运行构建和部署流程。</p>
                        
                        <h4 class="font-medium text-gray-800 mb-2">GitHub Actions 优势：</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-600">
                            <li>与 GitHub 深度集成</li>
                            <li>无需维护额外服务器</li>
                            <li>丰富的官方和社区 Actions</li>
                            <li>支持矩阵构建和多操作系统测试</li>
                        </ul>
                    </div>
                    <div class="bg-gray-50 p-6">
                        <div class="code-block relative">
                            <button class="copy-btn" onclick="copyCode(this)"><i class="fas fa-copy mr-1"></i>复制</button>
                            <pre><code class="language-yaml">name: Java CI/CD Pipeline

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - name: Setup JDK
        uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: '11'

      - name: Build Project
        run: mvn clean package

      - name: Deploy to Server
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
        run: |
          echo "$SSH_PRIVATE_KEY" > private_key && chmod 600 private_key
          scp -i private_key target/my-app.jar user@server:/home/user/app.jar
          ssh -i private_key user@server "nohup java -jar /home/user/app.jar &"</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                <h3 class="text-xl font-semibold mb-6 text-center">CI/CD 流程可视化</h3>
                <div class="mermaid">
                    graph LR
                        A[代码提交] --> B[代码拉取]
                        B --> C[代码构建]
                        C --> D[单元测试]
                        D --> E[集成测试]
                        E --> F[部署到测试环境]
                        F --> G[验收测试]
                        G --> H[部署到生产环境]
                        H --> I[监控与反馈]
                        style A fill:#4F46E5,color:white
                        style I fill:#10B981,color:white
                </div>
            </div>
        </section>

        <!-- Best Practices Section -->
        <section class="mb-20">
            <div class="flex items-center mb-10">
                <div class="h-1 bg-indigo-500 w-16 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">自动化构建与部署最佳实践</h2>
            </div>

            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-indigo-500 mb-4 text-3xl">
                        <i class="fas fa-code-branch"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">分支策略</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>使用Git Flow或GitHub Flow</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>保护主分支</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>Pull Request + Code Review</span>
                        </li>
                    </ul>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-blue-500 mb-4 text-3xl">
                        <i class="fas fa-vial"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">测试策略</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>分层测试：单元、集成、E2E</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>测试覆盖率要求</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>测试失败阻止部署</span>
                        </li>
                    </ul>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-purple-500 mb-4 text-3xl">
                        <i class="fas fa-shield-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">安全实践</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>密钥管理（Vault/Secrets）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>依赖安全检查</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>最小权限原则</span>
                        </li>
                    </ul>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-yellow-500 mb-4 text-3xl">
                        <i class="fas fa-tachometer-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">监控与反馈</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>部署后自动化测试</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>应用性能监控</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>错误跟踪与报警</span>
                        </li>
                    </ul>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-green-500 mb-4 text-3xl">
                        <i class="fas fa-boxes"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">环境管理</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>环境隔离（Dev/Test/Prod）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>基础设施即代码</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>容器化部署</span>
                        </li>
                    </ul>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-red-500 mb-4 text-3xl">
                        <i class="fas fa-undo"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">回滚策略</h3>
                    <ul class="space-y-2 text-gray-600">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>蓝绿部署</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>金丝雀发布</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>快速回滚机制</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Final Thoughts -->
        <section class="mb-20">
            <div class="bg-indigo-50 p-8 rounded-xl">
                <div class="flex items-start">
                    <div class="text-indigo-500 text-3xl mr-4">
                        <i class="fas fa-rocket"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-semibold mb-4 text-indigo-800">迈向高效的DevOps实践</h3>
                        <p class="text-gray-700 mb-4">自动化构建与部署是DevOps文化的重要组成部分，它将传统的手工操作转变为标准化的流程，使团队能够更快、更可靠地交付软件。通过选择合适的工具、建立有效的流程并持续改进，你的团队可以实现：</p>
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>更快的交付周期 - 从几天缩短到几小时甚至几分钟</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>更高的代码质量 - 通过自动化测试确保每次提交都符合标准</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>更好的协作 - 开发与运维团队共同负责交付流程</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>更强的可靠性 - 减少人为错误，提高系统稳定性</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-6 md:px-12 max-w-6xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-xl font-bold mb-2">技术小馆</h3>
                    <p class="text-gray-400">专业的软件技术知识分享平台</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300 flex items-center">
                        <i class="fas fa-globe mr-2"></i> http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Copy code block functionality
        function copyCode(button) {
            const codeBlock = button.nextElementSibling;
            const range = document.createRange();
            range.selectNode(codeBlock);
            window.getSelection().removeAllRanges();
            window.getSelection().addRange(range);
            document.execCommand('copy');
            window.getSelection().removeAllRanges();
            
            // Change button text temporarily
            const originalText = button.innerHTML;
            button.innerHTML = '<i class="fas fa-check mr-1"></i>已复制';
            setTimeout(() => {
                button.innerHTML = originalText;
            }, 2000);
        }

        // Add animation on scroll
        document.addEventListener('DOMContentLoaded', () => {
            const animateElements = document.querySelectorAll('.animate-fade-in');
            
            const observer = new IntersectionObserver((entries) => {
                entries.forEach(entry => {
                    if (entry.isIntersecting) {
                        entry.target.style.opacity = 1;
                        entry.target.style.transform = 'translateY(0)';
                        observer.unobserve(entry.target);
                    }
                });
            }, {
                threshold: 0.1
            });

            animateElements.forEach(element => {
                observer.observe(element);
            });
        });
    </script>
</body>
</html>